<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<style>
			html {
				font-family: Roboto, Arial, "Noto Sans CJK SC", "Noto Sans CJK TC", "Pingfang SC", "Microsoft Yahei", "WenQuanYi Micro Hei", sans-serif;
			}
			
			body {
				overflow-x: hidden;
				background-color: #fff !important;
			}
			
			.mui-content {
				background-color: #fff;
				text-align: center;
			}
			.from{
				font-size: 16px;
				margin-top: 20px;
			}
			.header {
				margin-top: 30px;
			}
			
			.header img {
				height: 120px;
			}
			
			.user-id {
				margin-top: 10px;
			}
			
			.user-name {
				margin-top: 10px;
			}
			
			.user-integral {
				margin-top: 15px;
			}
			
			.complete {
				margin-top: 50px;
			}
			
			.num {
				margin-top: 20px;
				font-weight: 700;
			}
		</style>
	</head>

	<body>
		<div class="mui-content">
			<div class="from"></div>
			<div class="header">
				<img src="" alt="" />
			</div>
			<div class="user-id">ID:</div>
			<div class="user-name">名字</div>
			<div class="user-integral">当前积分：0</div>
			<div class="num"></div>
			<button type="button" class="mui-btn mui-btn-primary complete">完成</button>
		</div>
		<script src="../config.js"></script>
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init({
				beforeback: function() {
					var allPage = plus.webview.all()
					var nowPage = plus.webview.getWebviewById('index')
					for(var i = 0; i < allPage.length; i++) {
						if(allPage[i].getURL() !== nowPage.getURL()) {
							plus.webview.close(allPage[i]);
						}
					}
					return true;
				}
			})
			var member = {},
				score = 0,
				currentShopObj,
				type = '',
				syncdata = {}
			mui.plusReady(function() {
				receiveParams()
				setPage()
				success()
			})

			function receiveParams() {
				var self = plus.webview.currentWebview()
				currentShopObj = self.currentShopObj
				score = self.score
				member = self.member
				syncdata  = self.syncdata
				type = self.type
				num = self.num
				if(type === 1) {
					document.querySelector(".num").innerText = '编号：' + num
				}
			}

			function setPage() {
				if(type === 4) {
					document.querySelector(".from").innerText = member.from +'会员'
					document.querySelector(".header img").setAttribute('src', member.userHead.indexOf('http')===-1?(config.imgPath + member.userHead):member.userHead)
					document.querySelector(".user-id").innerText = 'ID：' + member.userId
					document.querySelector(".user-name").innerText = member.userNick
					document.querySelector(".user-integral").innerText = '当前彩票：' + syncdata.userScore
				} else {
					document.querySelector(".header img").setAttribute('src',member.header.indexOf('http')===-1? (config.imgPath + member.header):member.header)
					document.querySelector(".user-id").innerText = 'ID：' + member.userId
					if(member.userName) {
						document.querySelector(".user-name").innerText = member.userName
					} else {
						document.querySelector(".user-name").innerText = '--'
					}
					document.querySelector(".user-integral").innerText = '当前积分：' + score
				}
			}

			function success() {
				document.querySelector(".complete").addEventListener('tap', function() {
					var allPage = plus.webview.all()
					var nowPage = plus.webview.getWebviewById('index')
					for(var i = 0; i < allPage.length; i++) {
						if(allPage[i].getURL() !== nowPage.getURL()) {
							plus.webview.close(allPage[i]);
						}
					}
				})
			}
		</script>
	</body>

</html>